﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TakePhotoTogether.Resources;


namespace TakePhotoTogether
{
    public  class StateDictionary
    {
        
        #region StringDictionary
        private const string preTapState = "PreTap";
        private const string preTapSplitState = "PreTapSplit";
        private const string connectingState = "Connecting";
        private const string connectingSplitState = "ConnectingSplit";
        private const string connected = "Connected";
        private const string myViewState = "MyView";
        private const string splitViewState = "SplitView";
        private const string noTapState = "NoTap";
        private const string noTapSplitState = "NoTapSplit";
        
        #endregion


        
        public bool capturing { get; set; }
        
        public bool isConnecting { get; set; }
        
        public bool isConnected { get; set; }

        public bool playStoryBoard { get; set; }

        public bool FriendVisible { get; set; }

        public bool cameraButtonState { get; set; }

        public bool cameraLockState { get; set; }

        public bool galleryButtonState { get; set; }

        public bool isSplit { get; set; }

        public bool shootButtonVisible { get; set; }

        public String circleState { get; set; }

        public String circleStateText { get; set; }

        public String stateName { get; set; }

        public String myFriendsLabelText { get; set; }

        public String nameStateReal { get; set; }

        private StateDictionary instance { get; set; }



        public StateDictionary getInstance(){
            if (this.instance == null)
            {
                this.instance = new StateDictionary();
            }
            return this.instance;
        }
        public StateDictionary NoTap()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = false;
            result.playStoryBoard = false;

            result.circleState = noTapState;
            result.circleStateText = AppResources.State_Circle_Recharge;
            result.stateName = noTapState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = true;
            result.cameraLockState = false;
            result.galleryButtonState = true;
            result.nameStateReal = "NoTap";
            result.isSplit = false;

            this.instance = result;

            return result;
        }

        public StateDictionary NoTapSplit()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = false;
            result.playStoryBoard = false;

            result.circleState = splitViewState;
            result.circleStateText = AppResources.State_Circle_Recharge;
            result.stateName = noTapSplitState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = false;
            result.cameraLockState = true;
            result.galleryButtonState = true;
            result.nameStateReal = "NoTapSplit";
            result.isSplit = true;

            this.instance = result;

            return result;
        }
        
        public StateDictionary PreTap() {
            StateDictionary result = getInstance();
            
            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = false;
            result.playStoryBoard = true;

            result.circleState = preTapState;
            result.circleStateText = AppResources.State_Circle_Tap;
            result.stateName = preTapState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = true;
            result.cameraLockState = false;
            result.galleryButtonState = true;
            result.nameStateReal = "PreTap";
            result.isSplit = false;
            
            this.instance = result;

            return result;
        }

        public StateDictionary PreTapSlit()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = false;
            result.playStoryBoard = true;

            result.circleState = splitViewState;
            result.circleStateText = AppResources.State_Circle_Tap;
            result.stateName = preTapSplitState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = false;
            result.cameraLockState = true;
            result.galleryButtonState = true;
            result.nameStateReal = "PreTapSplit";
            result.isSplit = true;
            
            this.instance = result;

            return result;
        }
        //os Estados Connected são os estado conectados dos aparelhos
        public StateDictionary Connected()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = true;
            result.playStoryBoard = false;

            result.circleState = connected;
            result.circleStateText = String.Empty;
            result.stateName = connected;
            result.myFriendsLabelText = AppResources.MainView_FriendsCamera;
            result.FriendVisible = false;
            result.cameraButtonState = true;
            result.cameraLockState = false;
            result.galleryButtonState = true;
            result.nameStateReal = "Connected";
            result.isSplit = false;
            
            this.instance = result;

            return result;
        }

        public StateDictionary ConnectedSplit()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = true;
            result.playStoryBoard = false;

            result.circleState = splitViewState;
            result.circleStateText = String.Empty;
            result.stateName = splitViewState;
            result.myFriendsLabelText = AppResources.MainView_FriendsCamera;
            result.FriendVisible = true;
            result.cameraButtonState = true;
            result.cameraLockState = false;
            result.galleryButtonState = true;
            result.nameStateReal = "ConnectedSplit";
            result.isSplit = true;
            
            this.instance = result;

            return result;
        }


        public StateDictionary Connecting()
        {
            StateDictionary result = getInstance();

            result.capturing = false;
            result.isConnecting = true;
            result.isConnected = false;
            result.playStoryBoard = true;

            result.circleState = connectingState;
            result.circleStateText = AppResources.State_Circle_Connecting;
            result.stateName = connectingState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = false;
            result.cameraLockState = true;
            result.galleryButtonState = true;
            result.nameStateReal = "Connecting";
            result.isSplit = false;
            this.instance = result;

            return result;
        }


        public StateDictionary ConnectingSplit()
        {
            StateDictionary result = getInstance();

            result.capturing = false;
            result.isConnecting = true;
            result.isConnected = false;
            result.playStoryBoard = true;

            result.circleState = connectingSplitState;
            result.circleStateText = AppResources.State_Circle_Connecting;
            result.stateName = connectingSplitState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = false;
            result.cameraLockState = true;
            result.galleryButtonState = true;
            result.isSplit = true;
            result.nameStateReal = "ConnectingSplit";
            
            this.instance = result;

            return result;
        }

        public StateDictionary MyView()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = true;
            result.playStoryBoard = true;

            result.circleState = connected;
            result.circleStateText = string.Empty;
            result.stateName = myViewState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = false;
            result.cameraButtonState = true;
            result.cameraLockState = false;
            result.galleryButtonState = true;
            result.isSplit = false;
            result.nameStateReal = "MyView";

            this.instance = result;

            return result;
        }

        public StateDictionary SplitView()
        {
            StateDictionary result = getInstance();

            result.capturing = true;
            result.isConnecting = false;
            result.isConnected = true;
            result.playStoryBoard = true;

            result.circleState = splitViewState;
            result.circleStateText = string.Empty;
            result.stateName = splitViewState;
            result.myFriendsLabelText = result.circleStateText;
            result.FriendVisible = true;
            result.cameraButtonState = true;
            result.cameraLockState = false;
            result.galleryButtonState = true;
            result.isSplit = true;
            result.nameStateReal = "SplitView";

            this.instance = result;

            return result;
        }
        
    }
}
